package ArrayTest10_13;

public class Test12 {
    public static void main(String[] args) {
        //定义一个整数数组，输出比平均值大的数
        int[] a = {1, 2, 3, 4, 5,8,213};
        int sum = 0;
        double avg = 0;
        System.out.println("数组为");
        for (int i :
                a) {
            System.out.print(i + " ");
        }
        System.out.println();
        for (int i = 0; i < a.length; i++) {
            sum += a[i];
        }
        avg = sum / a.length;
        System.out.println("平均值为:"+avg);

        System.out.print("大于平均值的数有:");
        for (int i = 0; i < a.length; i++) {
            if (avg < a[i]) {
                System.out.print(a[i]+" ");
            }
        }




    }
}
